//模块接口文件，暴露给外部模块使用
import { request } from "./core";
import METHOD from "./methods";
import URL from "./url";

const APIClient = {

  install(Vue) {
    Vue.prototype.$API = this;
  },
  /**
   * 
   * @param {*} mobile String
   * @param {*} password  String
   * 
   */
  login(mobile, password) { return request(METHOD.POST, URL.LOGIN, { mobile: mobile, pwd: password }) },

  /**
   * 
   * @param {*} mobile 
   * @param {*} password 
   * @param {*} code 
   * @param {*} nikcname 
   */
  register(mobile, password, code, nikcname) { return request(METHOD.POST, URL.REGISTER, { mobile: mobile, pwd: password, code: code, nikcname: nikcname }) },
  getStoreList() {
    return request(METHOD.GET, URL.STORELIST)
  },
  getSwiper() {
    return request(METHOD.GET, URL.SWIPER)
  },
  getZhuanti() {
    return request(METHOD.GET, URL.ZHUANTI)
  },
  getZhuanti1() {
    return request(METHOD.GET, URL.ZHUANTI1)
  },
  getDetail(id) {
    return request(METHOD.GET, URL.DETAIL + `?id=${id}`)
  },
  getKanjia() {
    return request(METHOD.GET, URL.KANJIA)
  },
  getClassList() {
    return request(METHOD.GET, URL.CLASS)
  },
  getShopdetail(id) {
    return request(METHOD.GET, URL.SHOPDETAIL + `?id=${id}`)
  },
  getLogin(mobile, password) {
    return request(METHOD.GET, URL.LOGIN + `&mobile=${mobile}&pwd=${password}`)
  },
}
export default APIClient;
